|
|
|
|
|
|
|
Listing A.28. Coding the AutoGen subroutine. |
|
|
|
|
|
|
|
|
Public Sub AutoGen(Optional cDB As Variant, Optional cSQV As Variant)
'
' ====================================================
' inputs:
' cDB database name to read
' cSQV script name to write
'
' outputs:
' produces script file
'
' processing:
' Ask for database to load and file to save results.
' Enum all tables, fields, indexes and relations
' ====================================================
'
' some local vars
EOL = Chr(13) + Chr(10)
INDENT = 3
intGlobalErr = False
'
' handle missing parms
If IsMissing(cDB) = True Then
cDB = ""
End If
If IsMissing(cSQV) = True Then
cSQV = ""
End If
'
' we can run silent
If cDB <> "" And cSQV <> "" Then
SQLVBMain.Visible = False
End If
'
AutoGenDBOpen cDB ' get mdb file
'
If intGlobalErr = False Then
AutoGenSQVOpen cSQV ' get sqv file
End If
'
If intGlobalErr = False Then
CreateScript ' create script
End If
'
' let'em know it's done
If intGlobalErr = False Then
If SQLVBMain.Visible = True Then
MsgBox cWrFile + " Script Created", vbInformation
End If
End If
'
' clean up
Close (nWrFile)
nWrFile = 0
cWrFile = "" |
|
|
|
|
|